######
#Figures 2 & 3: Cutting Line plots

##data preparation
oc_EP7$legislators$coord2D <- oc_EP7$legislators$coord2D * (-1)

x1 <- oc_EP7$legislators$coord1D
x2 <- oc_EP7$legislators$coord2D
epg <- oc_EP7$legislators$epg

oc_EP7$rollcalls[,7] <- oc_EP7$rollcalls[,7] * (-1)

N1 <- oc_EP7$rollcalls[,6] #extract Dim1 normal vector from oc_EP7$rollcalls
N2 <- oc_EP7$rollcalls[,7] #extract Dim2 normal vector from oc_EP7$rollcalls
ws <- oc_EP7$rollcalls[,8] #extract midpoints


##ACTA votes

xws34 <- ws[34]*N1[34] 
yws34 <- ws[34]*N2[34]  
N1W34 <- N1[34]  
N2W34 <- N2[34]

xws35 <- ws[35]*N1[35] 
yws35 <- ws[35]*N2[35]  
N1W35 <- N1[35]  
N2W35 <- N2[35]

xws36 <- ws[36]*N1[36] 
yws36 <- ws[36]*N2[36]  
N1W36 <- N1[36]  
N2W36 <- N2[36]  

xws37 <- ws[37]*N1[37] 
yws37 <- ws[37]*N2[37]  
N1W37 <- N1[37]  
N2W37 <- N2[37] 

xws38 <- ws[38]*N1[38] 
yws38 <- ws[38]*N2[38]  
N1W38 <- N1[38]  
N2W38 <- N2[38] 

xws39 <- ws[39]*N1[39] 
yws39 <- ws[39]*N2[39]  
N1W39 <- N1[39]  
N2W39 <- N2[39]

xws70 <- ws[70]*N1[70] 
yws70 <- ws[70]*N2[70]  
N1W70 <- N1[70]  
N2W70 <- N2[70]

xws72 <- ws[72]*N1[72] 
yws72 <- ws[72]*N2[72]  
N1W72 <- N1[72]  
N2W72 <- N2[72]

xws74 <- ws[74]*N1[74] 
yws74 <- ws[74]*N2[74]  
N1W74 <- N1[74]  
N2W74 <- N2[74]

xws75 <- ws[75]*N1[75] 
yws75 <- ws[75]*N2[75]  
N1W75 <- N1[75]  
N2W75 <- N2[75]

xws76 <- ws[76]*N1[76] 
yws76 <- ws[76]*N2[76]  
N1W76 <- N1[76]  
N2W76 <- N2[76]

xws78 <- ws[78]*N1[78] 
yws78 <- ws[78]*N2[78]  
N1W78 <- N1[78]  
N2W78 <- N2[78]

xws79 <- ws[79]*N1[79] 
yws79 <- ws[79]*N2[79]  
N1W79 <- N1[79]  
N2W79 <- N2[79]

xws81 <- ws[81]*N1[81] 
yws81 <- ws[81]*N2[81]  
N1W81 <- N1[81]  
N2W81 <- N2[81]

xws83 <- ws[83]*N1[83] 
yws83 <- ws[83]*N2[83]  
N1W83 <- N1[83]  
N2W83 <- N2[83]

xws85 <- ws[85]*N1[85] 
yws85 <- ws[85]*N2[85]  
N1W85 <- N1[85]  
N2W85 <- N2[85]

xws86 <- ws[86]*N1[86] 
yws86 <- ws[86]*N2[86]  
N1W86 <- N1[86]  
N2W86 <- N2[86]

xws87 <- ws[87]*N1[87] 
yws87 <- ws[87]*N2[87]  
N1W87 <- N1[87]  
N2W87 <- N2[87]

xws89 <- ws[89]*N1[89] 
yws89 <- ws[89]*N2[89]  
N1W89 <- N1[89]  
N2W89 <- N2[89]

xws90 <- ws[90]*N1[90] 
yws90 <- ws[90]*N2[90]  
N1W90 <- N1[90]  
N2W90 <- N2[90]

xws91 <- ws[91]*N1[91] 
yws91 <- ws[91]*N2[91]  
N1W91 <- N1[91]  
N2W91 <- N2[91]

xws92 <- ws[92]*N1[92] 
yws92 <- ws[92]*N2[92]  
N1W92 <- N1[92]  
N2W92 <- N2[92]

xws93 <- ws[93]*N1[93] 
yws93 <- ws[93]*N2[93]  
N1W93 <- N1[93]  
N2W93 <- N2[93]

xws95 <- ws[95]*N1[95] 
yws95 <- ws[95]*N2[95]  
N1W95 <- N1[95]  
N2W95 <- N2[95]

xws97 <- ws[97]*N1[97] 
yws97 <- ws[97]*N2[97]  
N1W97 <- N1[97]  
N2W97 <- N2[97]

xws98 <- ws[98]*N1[98] 
yws98 <- ws[98]*N2[98]  
N1W98 <- N1[98]  
N2W98 <- N2[98]

xws100 <- ws[100]*N1[100] 
yws100 <- ws[100]*N2[100]  
N1W100 <- N1[100]  
N2W100 <- N2[100]

xws102 <- ws[102]*N1[102] 
yws102 <- ws[102]*N2[102]  
N1W102 <- N1[102]  
N2W102 <- N2[102]

xws103 <- ws[103]*N1[103] 
yws103 <- ws[103]*N2[103]  
N1W103 <- N1[103]  
N2W103 <- N2[103]

xws104 <- ws[104]*N1[104] 
yws104 <- ws[104]*N2[104]  
N1W104 <- N1[104]  
N2W104 <- N2[104]

xws106 <- ws[106]*N1[106] 
yws106 <- ws[106]*N2[106]  
N1W106 <- N1[106]  
N2W106 <- N2[106]

xws107 <- ws[107]*N1[107] 
yws107 <- ws[107]*N2[107]  
N1W107 <- N1[107]  
N2W107 <- N2[107]

xws108 <- ws[108]*N1[108] 
yws108 <- ws[108]*N2[108]  
N1W108 <- N1[108]  
N2W108 <- N2[108]

xws109 <- ws[109]*N1[109] 
yws109 <- ws[109]*N2[109]  
N1W109 <- N1[109]  
N2W109 <- N2[109]

xws110 <- ws[110]*N1[110] 
yws110 <- ws[110]*N2[110]  
N1W110 <- N1[110]  
N2W110 <- N2[110]

xws111 <- ws[111]*N1[111] 
yws111 <- ws[111]*N2[111]  
N1W111 <- N1[111]  
N2W111 <- N2[111]

xws112 <- ws[112]*N1[112] 
yws112 <- ws[112]*N2[112]  
N1W112 <- N1[112]  
N2W112 <- N2[112]

xws113 <- ws[113]*N1[113] 
yws113 <- ws[113]*N2[113]  
N1W113 <- N1[113]  
N2W113 <- N2[113]

xws136 <- ws[136]*N1[136] 
yws136 <- ws[136]*N2[136]  
N1W136 <- N1[136]  
N2W136 <- N2[136]  

xws137 <- ws[137]*N1[137] 
yws137 <- ws[137]*N2[137]  
N1W137 <- N1[137]  
N2W137 <- N2[137] 

xws138 <- ws[138]*N1[138] 
yws138 <- ws[138]*N2[138]  
N1W138 <- N1[138]  
N2W138 <- N2[138] 


###ACTA I
ACTA_451 <- 451
ACTA_452 <- 452
ACTA_453 <- 453
ACTA_454 <- 454
ACTA_455 <- 455
ACTA_456 <- 456

rc_ep7_451 <- which(colnames(RCV_EP7$votes)==paste(ACTA_451,sep=""))
rc_ep7_452 <- which(colnames(RCV_EP7$votes)==paste(ACTA_452,sep=""))
rc_ep7_453 <- which(colnames(RCV_EP7$votes)==paste(ACTA_453,sep=""))
rc_ep7_454 <- which(colnames(RCV_EP7$votes)==paste(ACTA_454,sep=""))
rc_ep7_455 <- which(colnames(RCV_EP7$votes)==paste(ACTA_455,sep=""))
rc_ep7_456 <- which(colnames(RCV_EP7$votes)==paste(ACTA_456,sep=""))


###ACTA II
ACTA_1145 <- 1145
ACTA_1146 <- 1146
ACTA_1147 <- 1147
ACTA_1148 <- 1148
ACTA_1149 <- 1149
ACTA_1150 <- 1150
ACTA_1150 <- 1150
ACTA_1152 <- 1152
ACTA_1153 <- 1153
ACTA_1154 <- 1154
ACTA_1155 <- 1155
ACTA_1156 <- 1156
ACTA_1157 <- 1157
ACTA_1158 <- 1158
ACTA_1159 <- 1159
ACTA_1160 <- 1160
ACTA_1160 <- 1160
ACTA_1162 <- 1162
ACTA_1163 <- 1163
ACTA_1164 <- 1164
ACTA_1165 <- 1165
ACTA_1166 <- 1166
ACTA_1167 <- 1167
ACTA_1168 <- 1168
ACTA_1169 <- 1169
ACTA_1170 <- 1170
ACTA_1170 <- 1170
ACTA_1172 <- 1172
ACTA_1173 <- 1173
ACTA_1174 <- 1174
ACTA_1175 <- 1175
ACTA_1176 <- 1176
ACTA_1177 <- 1177
ACTA_1178 <- 1178
ACTA_1179 <- 1179
ACTA_1180 <- 1180
ACTA_1180 <- 1180
ACTA_1182 <- 1182
ACTA_1183 <- 1183
ACTA_1184 <- 1184
ACTA_1185 <- 1185
ACTA_1186 <- 1186
ACTA_1187 <- 1187
ACTA_1188 <- 1188
ACTA_1189 <- 1189

rc_ep7_1145 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1145,sep=""))
rc_ep7_1146 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1146,sep=""))
rc_ep7_1147 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1147,sep=""))
rc_ep7_1148 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1148,sep=""))
rc_ep7_1149 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1149,sep=""))
rc_ep7_1150 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1150,sep=""))
rc_ep7_1150 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1150,sep=""))
rc_ep7_1152 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1152,sep=""))
rc_ep7_1153 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1153,sep=""))
rc_ep7_1154 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1154,sep=""))
rc_ep7_1155 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1155,sep=""))
rc_ep7_1156 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1156,sep=""))
rc_ep7_1157 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1157,sep=""))
rc_ep7_1158 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1158,sep=""))
rc_ep7_1159 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1159,sep=""))
rc_ep7_1160 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1160,sep=""))
rc_ep7_1160 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1160,sep=""))
rc_ep7_1162 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1162,sep=""))
rc_ep7_1163 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1163,sep=""))
rc_ep7_1164 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1164,sep=""))
rc_ep7_1165 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1165,sep=""))
rc_ep7_1166 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1166,sep=""))
rc_ep7_1167 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1167,sep=""))
rc_ep7_1168 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1168,sep=""))
rc_ep7_1169 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1169,sep=""))
rc_ep7_1170 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1170,sep=""))
rc_ep7_1170 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1170,sep=""))
rc_ep7_1172 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1172,sep=""))
rc_ep7_1173 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1173,sep=""))
rc_ep7_1174 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1174,sep=""))
rc_ep7_1175 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1175,sep=""))
rc_ep7_1176 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1176,sep=""))
rc_ep7_1177 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1177,sep=""))
rc_ep7_1178 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1178,sep=""))
rc_ep7_1179 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1179,sep=""))
rc_ep7_1180 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1180,sep=""))
rc_ep7_1180 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1180,sep=""))
rc_ep7_1182 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1182,sep=""))
rc_ep7_1183 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1183,sep=""))
rc_ep7_1184 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1184,sep=""))
rc_ep7_1185 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1185,sep=""))
rc_ep7_1186 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1186,sep=""))
rc_ep7_1187 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1187,sep=""))
rc_ep7_1188 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1188,sep=""))
rc_ep7_1189 <- which(colnames(RCV_EP7$votes)==paste(ACTA_1189,sep=""))


###ACTA III
ACTA_3054 <- 3054
ACTA_3055 <- 3055

rc_ep7_3054 <- which(colnames(RCV_EP7$votes)==paste(ACTA_3054,sep=""))
rc_ep7_3055 <- which(colnames(RCV_EP7$votes)==paste(ACTA_3055,sep=""))


##Single Market for Electronic Communications

xws259 <- ws[259]*N1[259] 
yws259 <- ws[259]*N2[259]  
N1W259 <- N1[259]  
N2W259 <- N2[259]

xws260 <- ws[260]*N1[260] 
yws260 <- ws[260]*N2[260]  
N1W260 <- N1[260]  
N2W260 <- N2[260]

xws262 <- ws[262]*N1[262] 
yws262 <- ws[262]*N2[262]  
N1W262 <- N1[262]  
N2W262 <- N2[262]

xws263 <- ws[263]*N1[263] 
yws263 <- ws[263]*N2[263]  
N1W263 <- N1[263]  
N2W263 <- N2[263]

xws264 <- ws[264]*N1[264] 
yws264 <- ws[264]*N2[264]  
N1W264 <- N1[264]  
N2W264 <- N2[264]

xws265 <- ws[265]*N1[265] 
yws265 <- ws[265]*N2[265]  
N1W265 <- N1[265]  
N2W265 <- N2[265]

xws266 <- ws[266]*N1[266] 
yws266 <- ws[266]*N2[266]  
N1W266 <- N1[266]  
N2W266 <- N2[266]

xws267 <- ws[267]*N1[266] 
yws267 <- ws[267]*N2[266]  
N1W267 <- N1[267]  
N2W267 <- N2[267]

SMEC_6509 <- 6509
SMEC_6510 <- 6510
SMEC_6511 <- 6511
SMEC_6512 <- 6512
SMEC_6513 <- 6513
SMEC_6514 <- 6514
SMEC_6515 <- 6515
SMEC_6516 <- 6516
SMEC_6517 <- 6517
SMEC_6518 <- 6518

rc_ep7_6509 <- which(colnames(RCV_EP7$votes)==paste(SMEC_6509,sep=""))
rc_ep7_6510 <- which(colnames(RCV_EP7$votes)==paste(SMEC_6510,sep=""))
rc_ep7_6511 <- which(colnames(RCV_EP7$votes)==paste(SMEC_6511,sep=""))
rc_ep7_6512 <- which(colnames(RCV_EP7$votes)==paste(SMEC_6512,sep=""))
rc_ep7_6513 <- which(colnames(RCV_EP7$votes)==paste(SMEC_6513,sep=""))
rc_ep7_6514 <- which(colnames(RCV_EP7$votes)==paste(SMEC_6514,sep=""))
rc_ep7_6515 <- which(colnames(RCV_EP7$votes)==paste(SMEC_6515,sep=""))
rc_ep7_6516 <- which(colnames(RCV_EP7$votes)==paste(SMEC_6516,sep=""))
rc_ep7_6517 <- which(colnames(RCV_EP7$votes)==paste(SMEC_6517,sep=""))
rc_ep7_6518 <- which(colnames(RCV_EP7$votes)==paste(SMEC_6518,sep=""))

